import {setServer} from "@/utils/axios";
const request = setServer('');
import {hwUrl} from "../../../url";
const hwRequest = setServer(hwUrl);


// 查询用户信息
export function getUserInfo() {
  return request({
    url: '/user/user-token',
    method: 'get'
  })
}


/*
* 系统用户
* **/

// 查询用户列表
export function getSysUser(query) {
  return request({
    url: '/user/list',
    method: 'get',
    params: query
  })
}

// 查询用户详细
export function getSysUserDetail(id) {
  return request({
    url: '/user/' + id,
    method: 'get'
  })
}

// 新增用户
export function addSysUser(data) {
  return request({
    url: '/user/',
    method: 'post',
    data: data
  })
}

// 修改用户
export function updateSysUser(data) {
  return request({
    url: '/user/',
    method: 'put',
    data: data
  })
}

// 删除用户
export function deleteSysUser(data) {
  return request({
    url: '/user/enable',
    method: 'put',
    data: data
  })
}

// 修改密码
export function updatePwd(query) {
  return request({
    url: '/user/updatePasswordByPrimaryKey',
    method: 'post',
    params: query
  })
}

// 登录
export function login(query, content) {
  return request({
    url: '/user/toLogin',
    method: 'post',
    params: query,
    content: content
  })
}

// 退出
export function logout() {
  return request({
    url: '/user/logout',
    method: 'post',
  })
}



/*
* 华为用户
* **/

// 获取华为设备人员
export function getHuaweiUser(query) {
  return hwRequest({
    url: '/api/user/list',
    method: 'get',
    params: query
  })
}

// 华为失败人脸
export function getFailHuaweiUser(query) {
  return hwRequest({
    url: '/api/user/fail/',
    method: 'get',
    params: query
  })
}

// 删除华为设备人员
export function deleteHuaweiUser(id) {
  return hwRequest({
    url: '/api/user/' + id,
    method: 'delete'
  })
}

// 新增华为设备人员
export function addHuaweiUser(query) {
  return hwRequest({
    url: '/api/user/byUrl',
    method: 'post',
    data: query
  })
}

// 修改华为设备人员
export function updateHuaweiUser(query) {
  return hwRequest({
    url: '/api/user/byUrl',
    method: 'put',
    data: query
  })
}


